<?php

namespace App\Jobs\QiPao;

// 通用房间

use App\Jobs\Job;
use App\Services\Tools\RedisService;
use Illuminate\Support\Facades\Log;
class GeneralRoomJob extends Job
{
    public $_data = [];

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($data = [])
    {
        //
        $this->_data = $data;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        $data = $this->_data;
        $roomId = $data['room_id'] ?? 0;
        $popularity = $data['popularity'] ?? 0;
        $key = $data['key'] ?? '';
        echo "房间 $roomId, 减少人气: $popularity" . PHP_EOL;
        RedisService::decrRoomPopularity($roomId, $popularity, $key);
    }
}
